<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta charset="utf-8">
<titleInser Question</title>
<meta  name="viewport" content="width=divice-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile.structure-1.4.5.min.css" />
<link rel="stylesheet" type="text/css" href="../themes/Theme_app.css">
<link rel="stylesheet" type="text/css" href="../themes/jquery.mobile.icons.min.css">
<link rel="stylesheet" type="text/css" href="../themes/Theme_app.min.css">
<link rel="stylesheet" type="text/css" href="../css/Css_Header.css">
<link rel="stylesheet" type="text/css" href="../css/table.css">
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page" id="page">
	<div data-role="header">
		<h1>My Web Application</h1>
	</div>
    <div >
         <img src="../images/banner.jpg" width="1500" height="100">   
    </div> 
    <div align="center" id="container">
         เพิ่มคำถามใหม่
    </div>
	<form name="form1" method="post" action="insert.php" >
    
        <input type="text" name="Question"  placeholder="เพิ่มคำถามใหม่">
        <input type="text" name="c1" placeholder="คำตอบข้อที่ 1">
        <input type="text" name="c2" placeholder="คำตอบข้อที่ 2">
        <input type="text" name="c3" placeholder="คำตอบข้อที่ 3">
        <input type="text" name="c4" placeholder="คำตอบข้อที่ 4">
        <input type="text" name="answer" placeholder="เฉลยคำตอบที่ถูกต้อง">
	    <input name="btnSubmit" type="submit" value="บันทึก">
   
	</form>    
    <div data-role="main" >
        <div data-role="collapsible" data-theme="b" data-content-theme="b">
        <h4>Click  - แก้ไขข้อสอบ หมวด กฎหมายว่าด้วยรถยนต์</h4>
        <ul data-role="listview">
<?php
/*include('../connect/connect.php');*/
	$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
	mysql_query("SET character_set_results=utf8");
	mysql_query("SET character_set_client=utf8"); 
	mysql_query("SET character_set_connection=utf8");
	$objDB = mysql_select_db("table");
$strSQL = "SELECT * FROM  testing order by id DESC";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table>
<?php
$i=0;
while($objResult = mysql_fetch_array($objQuery))
	{
		$i++;
?>
<tr>
<td>
<? echo "$i"; ?>
  : <?=$objResult["question"]; ?>
  </td>
</tr>
<tr>
<td>
ข้อ 1 <?=$objResult["c1"]; ?>
  </td>
</tr>
<tr>
<td>
ข้อ 2 <?=$objResult["c2"]; ?>
  </td>
</tr>
<tr>
<td>
ข้อ 3 <?=$objResult["c3"]; ?>
  </td>
</tr>
<tr>
<td>
ข้อ 4 <?=$objResult["c4"]; ?>
  </td>
</tr>	
<tr>
<td><font color="#FF0000">
เฉลยคำตอบ :
  <?=$objResult["answer"]; ?> </font>
  </td>
</tr>
<tr >
<td colspan="2" align="center"><a href="QuestionEdit.php?id=<?=$objResult["id"];?>">Edit</a>
<a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='QuestionDelete.php?id=<?php echo $objResult["id"];?>';}">Delete</a></td>
</tr>	
<tr height="10px">
</tr>
<?php 		
    }
?>
</table>
     </ul>
   </div> 
 </div>
<a href="index_admin.php" class="ui-btn ui-icon-back ui-btn-icon-left" data-transition="slide" data-direction="reverse">กลับหน้าเมนูผู้ดูแลระบบ</a>  
<div data-role="footer">
		<h4>@Computer Science</h4>
	</div>
</div>
</body>
</html>